import logging

from sqlalchemy.exc import SQLAlchemyError

from app.models.problem import Solution

"""
根据作者id查看题解列表
"""
def get_solution_list_by_author(author_id):
    try:
        return Solution.query.filter_by(author_id=author_id).all()
    except SQLAlchemyError as e:
        logging.error(f"查询用户{author_id}题解列表失败: {str(e)}")
        return None